package com.sskj.functions.activity;

import android.content.Context;
import android.content.Intent;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.sskj.common.base.App;
import com.sskj.common.util.SPUtil;
import com.sskj.functions.R;
import com.sskj.functions.R2;
import com.sskj.functions.presenter.RegisterAgreementPresenter;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.lib.SPConfig;
import com.sskj.lib.SpApplication;
import com.sskj.lib.base.BaseActivity;
import com.zzhoujay.richtext.RichText;

import butterknife.BindView;

/**
 * @author Hey
 * Create at  2019/07/11
 */
@Route(path = RConfig.FUNCTIONS_REGISTER_AGREEMENT)
public class RegisterAgreementActivity extends BaseActivity<RegisterAgreementPresenter> {
    @BindView(R2.id.tvTitle)
    TextView tvTitle;
    @BindView(R2.id.tvContent)
    TextView tvContent;
    private String type = "3";
    private String languages = "1";


    @Override
    public int getLayoutId() {
        return R.layout.functions_activity_register_agreement;
    }

    @Override
    public RegisterAgreementPresenter getPresenter() {
        return new RegisterAgreementPresenter();
    }

    @Override
    public void initView() {
        tvTitle.setText(App.INSTANCE.getString(R.string.functions_registerAgreementActivity1));
        if (Constans.LANGUAGE_EN.equals(SPUtil.get(SPConfig.LANGUAGE, Constans.LANGUAGE_CNA))) {
            mPresenter.getAgreement(type, "2");
        } else if (Constans.LANGUAGE_CNA.equals(SPUtil.get(SPConfig.LANGUAGE, Constans.LANGUAGE_CNA))) {
            mPresenter.getAgreement(type, "1");
        } else if (Constans.LANGUAGE_TRA.equals(SPUtil.get(SPConfig.LANGUAGE, Constans.LANGUAGE_CNA))) {
            mPresenter.getAgreement(type, "3");
        }
    }

    @Override
    public void initData() {

    }

    public static void start(Context context) {
        Intent intent = new Intent(context, RegisterAgreementActivity.class);
        context.startActivity(intent);
    }

    public void getAgreementSuccess(String data) {
        RichText.from(data).into(tvContent);
    }
}
